home *** CD-ROM | disk | FTP | other *** search
/ Sky at Night 2006 September / SAN CD 9-2006 CD-ROM 16.iso / pc / Software / Network Telescope Control / NTC-Setup.Exe / Source / ntc_server_control.pas < prev    next >
Encoding:
Pascal/Delphi Source File  |  2006-03-24  |  33.6 KB  |  1,536 lines

  1. unit ntc_server_control;
  2. {
  3.     Copyright (C) 2004 - 2006 Andrew Sprott
  4.  
  5.     http://astronomy.crysania.co.uk
  6.     astro@trefach.co.uk
  7.  
  8.     This program is free software; you can redistribute it and/or
  9.     modify it under the terms of the GNU General Public License
  10.     as published by the Free Software Foundation; either version 2
  11.     of the License, or (at your option) any later version.
  12.  
  13.     This program is distributed in the hope that it will be useful,
  14.     but WITHOUT ANY WARRANTY; without even the implied warranty of
  15.     MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  16.     GNU General Public License for more details.
  17.  
  18.     You should have received a copy of the GNU General Public License
  19.     along with this program; if not, write to the Free Software
  20.     Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
  21. }
  22.  
  23. interface
  24.  
  25. uses
  26.     Windows,
  27.     Messages,
  28.     SysUtils,
  29.     Variants,
  30.     Classes,
  31.     Graphics,
  32.     Controls,
  33.     Forms,
  34.     Dialogs,
  35.     StdCtrls,
  36.     ExtCtrls,
  37.     Buttons,
  38.     inifiles,
  39.     ComCtrls,
  40.  
  41.     ntc_server_form;
  42.  
  43. const
  44.     { scope types }
  45.     max_speeds=25;
  46.     window_track_max=50;
  47.     window_track_step=2;
  48.     window_method=0;
  49.     degree_method=1;
  50.     window_percent_default=80;
  51.     move_degrees_default=0;
  52.     move_minutes_default=0;
  53.     move_seconds_default=1;
  54.     { basics }
  55.     minutes_in_degree=60;
  56.     seconds_in_minute=60;
  57.     max_degrees=360;
  58.     max_degrees_dec=90;
  59.     max_hours=24;
  60.     cr=#13;
  61.  
  62. type
  63.     buttons_type_set=(
  64.         button_north,
  65.         button_south,
  66.         button_east,
  67.         button_west);
  68.     buttons_type=set of buttons_type_set;
  69.  
  70. const
  71.     buttons_all:buttons_type=[
  72.         button_north,
  73.         button_south,
  74.         button_east,
  75.         button_west];
  76.  
  77. type
  78.     Tscope_control = class(tform)
  79.         control_panel: TPanel;
  80.         slew_group: TGroupBox;
  81.         north_button: TSpeedButton;
  82.         east_button: TSpeedButton;
  83.         west_button: TSpeedButton;
  84.         south_button: TSpeedButton;
  85.     stop_button: TSpeedButton;
  86.         north_label: TLabel;
  87.         west_label: TLabel;
  88.         south_label: TLabel;
  89.         east_label: TLabel;
  90.         connect_group: TGroupBox;
  91.         connect_button: TSpeedButton;
  92.         disconnect_button: TSpeedButton;
  93.         led_display: TEdit;
  94.         goto_group: TGroupBox;
  95.         ra_hours_edit: TEdit;
  96.         ra_minutes_edit: TEdit;
  97.         ra_seconds_edit: TEdit;
  98.         dec_degrees_edit: TEdit;
  99.         dec_minutes_edit: TEdit;
  100.         dec_seconds_edit: TEdit;
  101.         ra_label: TLabel;
  102.         dec_label: TLabel;
  103.         hours_label: TLabel;
  104.         ra_minutes_label: TLabel;
  105.         ra_seconds_label: TLabel;
  106.         dec_minutes_label: TLabel;
  107.         dec_seconds_label: TLabel;
  108.         degrees_label: TLabel;
  109.         goto_button: TBitBtn;
  110.         locked_check: TCheckBox;
  111.         ra_hours_up_down: TUpDown;
  112.     dec_degrees_up_down: TUpDown;
  113.         ra_minutes_up_down: TUpDown;
  114.         dec_minutes_up_down: TUpDown;
  115.         ra_seconds_up_down: TUpDown;
  116.         dec_seconds_up_down: TUpDown;
  117.         refresh_button: TBitBtn;
  118.         move_units_group: TGroupBox;
  119.         move_degrees_up_down: TUpDown;
  120.         move_minutes_up_down: TUpDown;
  121.         move_degrees_edit: TEdit;
  122.         move_minutes_edit: TEdit;
  123.         move_seconds_edit: TEdit;
  124.         move_seconds_up_down: TUpDown;
  125.         move_seconds_label: TLabel;
  126.         move_minutes_label: TLabel;
  127.         move_degrees_label: TLabel;
  128.         window_move_button: TSpeedButton;
  129.         degree_move_button: TSpeedButton;
  130.         move_window_group: TGroupBox;
  131.         degrees_edit: TEdit;
  132.         window_track: TTrackBar;
  133.         window_label: TLabel;
  134.  
  135.         { form functions }
  136.         procedure formcreate(
  137.             Sender:TObject);
  138.  
  139.         procedure form_close_query(
  140.                     Sender: TObject;
  141.             var CanClose: Boolean);
  142.  
  143.         { scope linkage }
  144.         procedure flip_buttons(
  145.             toggle:boolean);
  146.  
  147.         procedure change_panel(
  148.             toggle:boolean);
  149.  
  150.         procedure connect_to_scope;
  151.  
  152.         procedure disconnect_from_scope;
  153.  
  154.         { directional controls }
  155.         procedure stop_failed;
  156.  
  157.         procedure move_down;
  158.         procedure move_up;
  159.         procedure move_left;
  160.         procedure move_right;
  161.  
  162.         procedure move_distance(
  163.             d:string);
  164.  
  165.         procedure north_button_down(
  166.             Sender:TObject);
  167.  
  168.         procedure south_button_down(
  169.             Sender:TObject);
  170.  
  171.         procedure east_button_down(
  172.             Sender:TObject);
  173.  
  174.         procedure west_button_down(
  175.             Sender:TObject);
  176.  
  177.         procedure stop_button_down(
  178.             Sender:TObject);
  179.  
  180.         procedure stop_scope;
  181.  
  182.         { goto }
  183.         procedure go_to;
  184.  
  185.         { speed controls }
  186.         procedure update_speed_group(
  187.             speed_box:tpanel;
  188.             first_speed_button:tspeedbutton;
  189.             start_speed,
  190.             speed_count:integer;
  191.             event:TNotifyEvent;
  192.             can_do:boolean);
  193.  
  194.         function set_slew_speed(
  195.             speed_box:tpanel)
  196.             :integer;
  197.  
  198.         { logging }
  199.         procedure write_status_log(
  200.             e:string);
  201.  
  202.         { configuration }
  203.         procedure load_settings;
  204.  
  205.         procedure save_settings;
  206.  
  207.         { utilites }
  208.         procedure change_window_method;
  209.         procedure change_degree_method;
  210.  
  211.         procedure update_degrees;
  212.  
  213.         procedure update_edit_boxes;
  214.         procedure update_ra_edit_boxes;
  215.         procedure update_dec_edit_boxes;
  216.  
  217.         { events }
  218.         procedure FormShow(
  219.             Sender:TObject);
  220.  
  221.         procedure adjust;
  222.  
  223.         procedure check_activate(
  224.             Sender: TObject);
  225.  
  226.         procedure east_labelClick(
  227.             Sender: TObject);
  228.  
  229.         procedure west_labelClick(
  230.             Sender: TObject);
  231.  
  232.         procedure north_labelClick(
  233.             Sender: TObject);
  234.  
  235.         procedure south_labelClick(
  236.             Sender: TObject);
  237.  
  238.         procedure disconnect_from_scope_click(
  239.             Sender:TObject);
  240.  
  241.         procedure connect_to_scope_click(
  242.             sender:tobject);
  243.  
  244.         procedure goto_buttonClick(
  245.             Sender: TObject);
  246.  
  247.         procedure window_move_buttonClick(
  248.             Sender: TObject);
  249.  
  250.         procedure degree_move_buttonClick(
  251.             Sender: TObject);
  252.  
  253.         procedure window_trackChange(
  254.             Sender: TObject);
  255.  
  256.         procedure degrees_editKeyPress(
  257.                     Sender: TObject;
  258.             var Key: Char);
  259.  
  260.         procedure move_degrees_editKeyPress(
  261.                     Sender: TObject;
  262.             var Key: Char);
  263.  
  264.         procedure move_minutes_editKeyPress(
  265.                     Sender: TObject;
  266.             var Key: Char);
  267.  
  268.         procedure move_seconds_editKeyPress(
  269.                     Sender: TObject;
  270.             var Key: Char);
  271.  
  272.         procedure move_degrees_up_downChanging(
  273.                     Sender: TObject;
  274.             var AllowChange: Boolean);
  275.  
  276.         procedure move_minutes_up_downChanging(
  277.                     Sender: TObject;
  278.             var AllowChange: Boolean);
  279.  
  280.         procedure move_seconds_up_downChanging(
  281.                     Sender: TObject;
  282.             var AllowChange: Boolean);
  283.  
  284.         procedure move_degrees_editEnter(
  285.             Sender: TObject);
  286.  
  287.         procedure ra_hours_editKeyPress(
  288.                     Sender: TObject;
  289.             var Key: Char);
  290.  
  291.         procedure ra_minutes_editKeyPress(
  292.                     Sender: TObject;
  293.             var Key: Char);
  294.  
  295.         procedure ra_seconds_editKeyPress(
  296.                     Sender: TObject;
  297.             var Key: Char);
  298.  
  299.         procedure dec_degrees_editKeyPress(
  300.                     Sender: TObject;
  301.             var Key: Char);
  302.  
  303.         procedure dec_minutes_editKeyPress(
  304.                     Sender: TObject;
  305.             var Key: Char);
  306.  
  307.         procedure dec_seconds_editKeyPress(
  308.                     Sender: TObject;
  309.             var Key: Char);
  310.  
  311.         procedure ra_hours_up_downChanging(
  312.                     Sender: TObject;
  313.             var AllowChange: Boolean);
  314.  
  315.         procedure ra_minutes_up_downChanging(
  316.                     Sender: TObject;
  317.             var AllowChange: Boolean);
  318.  
  319.         procedure ra_seconds_up_downChanging(
  320.                     Sender: TObject;
  321.             var AllowChange: Boolean);
  322.  
  323.         procedure dec_degrees_up_downChanging(
  324.                     Sender: TObject;
  325.             var AllowChange: Boolean);
  326.  
  327.         procedure dec_minutes_up_downChanging(
  328.                     Sender: TObject;
  329.             var AllowChange: Boolean);
  330.  
  331.         procedure dec_seconds_up_downChanging(
  332.                     Sender: TObject;
  333.             var AllowChange: Boolean);
  334.  
  335.         procedure move_degrees_editClick(
  336.             Sender: TObject);
  337.  
  338.         procedure move_minutes_editClick(
  339.             Sender: TObject);
  340.  
  341.         procedure move_seconds_editClick(
  342.             Sender: TObject);
  343.  
  344.     private
  345.         { Private declarations }
  346.         north_south_reversed,
  347.         east_west_reversed:boolean;
  348.     public
  349.         { Public declarations }
  350.         moving_scope:boolean;
  351.         scope_name:shortstring;
  352.         ignore_event_north,
  353.         ignore_event_south,
  354.         ignore_event_west,
  355.         ignore_event_east:longint;
  356.         can_slew,
  357.         can_goto,
  358.         can_sync:boolean;
  359.         { configuration }
  360.         dimensions:dimensions_record;
  361.         { slew controls }
  362.         move_method:integer;
  363.         { window method }
  364.         window_percent:extended;
  365.         { degree method }
  366.         move_degrees,
  367.         move_minutes,
  368.         move_seconds:extended;
  369.         degrees_updating,
  370.         minutes_updating,
  371.         seconds_updating,
  372.         ra_hours_updating,
  373.         ra_minutes_updating,
  374.         ra_seconds_updating,
  375.         dec_degrees_updating,
  376.         dec_minutes_updating,
  377.         dec_seconds_updating:boolean;
  378.  
  379.         procedure normalise(
  380.                     max_degrees:integer;
  381.             var degrees,
  382.                     minutes,
  383.                     seconds:extended);
  384.  
  385.         { events }
  386.         procedure check_visible_and_show_hide(
  387.             sender:tobject);
  388.  
  389.         procedure hide_form;
  390.         procedure show_form;
  391.     end;
  392.  
  393. { global variables }
  394. var
  395.     scope_control:Tscope_control;
  396.  
  397. implementation
  398.  
  399. uses
  400.     ntc_server_network,
  401.     ntc_server_info,
  402.     ntc_server_focus,
  403.     ntc_server_tracking,
  404.     ntc_server_object,
  405.     ntc_server_search,
  406.     ntc_server_config;
  407.  
  408. {$R *.dfm}
  409.  
  410.     { -------------
  411.         form controls
  412.         ------------- }
  413.  
  414. procedure tscope_control.formcreate(
  415.     Sender:TObject);
  416. begin
  417.     ignore_event_north:=event_0;
  418.     ignore_event_south:=event_0;
  419.     ignore_event_east:=event_0;
  420.     ignore_event_west:=event_0;
  421.     flip_buttons(false);
  422.     move_degrees_up_down.max:=max_degrees-1;
  423.     move_minutes_up_down.max:=minutes_in_degree-1;
  424.     move_seconds_up_down.max:=seconds_in_minute-1;
  425.     move_degrees_up_down.min:=0;
  426.     move_minutes_up_down.min:=0;
  427.     move_seconds_up_down.min:=0;
  428.     { goto }
  429.     ra_hours_up_down.min:=0;
  430.     ra_minutes_up_down.min:=0;
  431.     ra_seconds_up_down.min:=0;
  432.     dec_degrees_up_down.min:=0;
  433.     dec_minutes_up_down.min:=0;
  434.     dec_seconds_up_down.min:=0;
  435.     ra_hours_up_down.max:=max_hours-1;
  436.     ra_minutes_up_down.max:=minutes_in_degree-1;
  437.     ra_seconds_up_down.max:=seconds_in_minute-1;
  438.     dec_degrees_up_down.max:=max_degrees_dec-1;
  439.     dec_minutes_up_down.max:=minutes_in_degree-1;
  440.     dec_seconds_up_down.max:=seconds_in_minute-1;
  441.     { temporary }
  442.     can_slew:=true;
  443.     window_track.min:=0;
  444.     window_track.max:=window_track_max;
  445.     degrees_updating:=false;
  446.     minutes_updating:=false;
  447.     seconds_updating:=false;
  448.     ra_hours_updating:=false;
  449.     ra_minutes_updating:=false;
  450.     ra_seconds_updating:=false;
  451.     dec_degrees_updating:=false;
  452.     dec_minutes_updating:=false;
  453.     dec_seconds_updating:=false;
  454.     load_settings;
  455.     moving_scope:=false;
  456. end;
  457.  
  458. procedure Tscope_control.form_close_query(
  459.             Sender: TObject;
  460.     var CanClose: Boolean);
  461. begin
  462.     canclose:=false;
  463.     visible:=false;
  464.     with dimensions do
  465.         begin
  466.             form_top:=top;
  467.             form_left:=left;
  468.         end;
  469. end;
  470.  
  471.     { -------------
  472.         scope linkage
  473.         ------------- }
  474.  
  475. procedure Tscope_control.flip_buttons(
  476.     toggle:boolean);
  477. begin
  478.     slew_group.enabled:=toggle;
  479.     if toggle then
  480.         begin
  481.             if move_method=window_method then
  482.                 change_window_method
  483.             else
  484.                 change_degree_method;
  485.         end
  486.     else
  487.         begin
  488.             move_window_group.enabled:=false;
  489.             move_units_group.Enabled:=false;
  490.         end;
  491.     east_button.enabled:=toggle;
  492.     north_button.enabled:=toggle;
  493.     west_button.enabled:=toggle;
  494.     south_button.enabled:=toggle;
  495.     stop_button.enabled:=toggle;
  496.     goto_group.enabled:=toggle;
  497. end;
  498.  
  499. function send_message(
  500.     m,
  501.     e:string)
  502.     :response_type;
  503. begin
  504.     result:=scope_network.send_message(m,e);
  505. end;
  506.  
  507. function send_message_check(
  508.     m:string)
  509.     :response_type;
  510. begin
  511.     result:=scope_network.send_message_check(m);
  512. end;
  513.  
  514. procedure Tscope_control.change_panel(
  515.     toggle:boolean);
  516. begin
  517.     if toggle then
  518.         begin
  519.             if not moving_scope then
  520.                 begin
  521.                     led_display.color:=clRed;
  522.                     led_display.refresh;
  523.                 end;
  524.             if can_slew then
  525.                 flip_buttons(scope_network.local_scope_control)
  526.             else
  527.                 flip_buttons(false);
  528.             with scope_focus do
  529.                  if can_focus then
  530.                 begin
  531.                     update_speed_group(
  532.                         speed_box,
  533.                         first_speed_button,
  534.                         start_focus_speed,
  535.                         focus_speeds,
  536.                         speed_button_click,
  537.                         can_focus);
  538.                     flip_buttons(scope_network.local_scope_control);
  539.                 end
  540.             else
  541.                 flip_buttons(false);
  542.             with scope_tracking do
  543.                  if can_track then
  544.                 flip_buttons(scope_network.local_scope_control)
  545.             else
  546.                 flip_buttons(false);
  547.             if scope_network.local_scope_control then
  548.                 scope_search.enable_panel
  549.             else
  550.                 scope_search.disable_panel;
  551.             if not moving_scope then
  552.                 begin
  553.                     led_display.color:=clLime;
  554.                     led_display.refresh;
  555.                 end;
  556.             connect_button.Enabled:=not toggle;
  557.             disconnect_button.enabled:=toggle;
  558.         end
  559.     else
  560.         begin
  561.             scope_focus.flip_buttons(false);
  562.             scope_tracking.flip_buttons(false);
  563.             flip_buttons(false);
  564.             if not moving_scope then
  565.                 begin
  566.                     led_display.color:=clred;
  567.                     led_display.refresh;
  568.                     connect_button.Enabled:=not toggle;
  569.                 end;
  570.             disconnect_button.enabled:=toggle;
  571.             scope_search.disable_panel;
  572.         end;
  573.     if scope_focus.focused then
  574.         scope_focus.show;
  575.     if focused then
  576.         Show;
  577. end;
  578.  
  579. procedure Tscope_control.connect_to_scope;
  580. begin
  581.     if send_message('connect','Connection to scope failed')>=[exit_ok] then
  582.         begin
  583.             scope_info.get_info;
  584.             change_panel(scope_network.local_scope_control);
  585.         end;
  586. end;
  587.  
  588. procedure tscope_control.disconnect_from_scope;
  589. begin
  590.     if send_message_check('disconnect')>=[exit_ok] then
  591.          with scope_control do
  592.         begin
  593.             led_display.color:=clRed;
  594.             led_display.refresh;
  595.             flip_buttons(false);
  596.             if focused then
  597.                 show;
  598.         end;
  599. end;
  600.  
  601.     { -------------------
  602.         directional buttons
  603.         ------------------- }
  604.  
  605. procedure tscope_control.stop_failed;
  606. begin
  607.     showmessage(stop_error);
  608. end;
  609.  
  610. procedure tscope_control.move_down;
  611. begin
  612.     scope_network.send_message_check('move_screen_down');
  613. end;
  614.  
  615. procedure tscope_control.move_up;
  616. begin
  617.     scope_network.send_message_check('move_screen_up');
  618. end;
  619.  
  620. procedure tscope_control.move_left;
  621. begin
  622.     scope_network.send_message_check('move_screen_left');
  623. end;
  624.  
  625. procedure tscope_control.move_right;
  626. begin
  627.     scope_network.send_message_check('move_screen_right');
  628. end;
  629.  
  630. procedure tscope_control.move_distance(
  631.     d:string);
  632. var
  633.     t_ra:double;
  634. begin
  635.     t_ra:=move_seconds/seconds_in_minute;
  636.     t_ra:=(t_ra+move_minutes)/minutes_in_degree;
  637.     t_ra:=t_ra+move_degrees;
  638.     scope_network.send_message_check('move_'+d+'(distance='+floattostr(t_ra)+')');
  639. end;
  640.  
  641. procedure tscope_control.north_button_down(
  642.     Sender:TObject);
  643. begin
  644.     if not moving_scope then
  645.         begin
  646.             moving_scope:=true;
  647.             write_status_log('north - begin');
  648.             if move_method=window_method then
  649.                 begin
  650.                     if north_label.caption='N' then
  651.                         move_up
  652.                     else
  653.                         move_down;
  654.                 end
  655.             else if move_degrees+move_minutes+move_seconds>0 then
  656.                 move_distance('up')
  657.             else
  658.                 moving_scope:=false;
  659.             write_status_log('north - end');
  660.         end;
  661. end;
  662.  
  663. procedure tscope_control.south_button_down(
  664.     Sender:TObject);
  665. begin
  666.     if not moving_scope then
  667.         begin
  668.             moving_scope:=true;
  669.             write_status_log('south - begin');
  670.             if move_method=window_method then
  671.                 begin
  672.                     if south_label.caption='S' then
  673.                         move_down
  674.                     else
  675.                         move_up;
  676.                 end
  677.             else if move_degrees+move_minutes+move_seconds>0 then
  678.                 move_distance('down')
  679.             else
  680.                 moving_scope:=false;
  681.             write_status_log('south - end');
  682.         end;
  683. end;
  684.  
  685. procedure tscope_control.east_button_down(
  686.     Sender:TObject);
  687. begin
  688.     if not moving_scope then
  689.         begin
  690.             moving_scope:=true;
  691.             write_status_log('east - begin');
  692.             if move_method=window_method then
  693.                 begin
  694.                     if west_label.caption='W' then
  695.                         move_left
  696.                     else
  697.                         move_right;
  698.                 end
  699.             else if move_degrees+move_minutes+move_seconds>0 then
  700.                 move_distance('right')
  701.             else
  702.                 moving_scope:=false;
  703.             write_status_log('east - end');
  704.         end;
  705. end;
  706.  
  707. procedure tscope_control.west_button_down(
  708.     Sender:TObject);
  709. begin
  710.     if not moving_scope then
  711.         begin
  712.             moving_scope:=true;
  713.             write_status_log('west - begin');
  714.             if move_method=window_method then
  715.                 begin
  716.                     if east_label.caption='E' then
  717.                         move_right
  718.                     else
  719.                         move_left;
  720.                 end
  721.             else if move_degrees+move_minutes+move_seconds>0 then
  722.                 move_distance('left')
  723.             else
  724.                 moving_scope:=false;
  725.             write_status_log('west - end');
  726.         end;
  727. end;
  728.  
  729. procedure tscope_control.stop_scope;
  730. begin
  731.     if not (send_message_check('stop')>=[exit_ok]) then
  732.         stop_failed;
  733. end;
  734.  
  735. procedure tscope_control.stop_button_down(
  736.     Sender:TObject);
  737. begin
  738.     stop_scope;
  739. end;
  740.  
  741.     { ----
  742.         goto
  743.         ---- }
  744.  
  745. procedure tscope_control.go_to;
  746. begin
  747.     with current_object do
  748.         begin
  749.             ra:=strtointdef(ra_seconds_edit.text,0)/60;
  750.             ra:=(ra+strtointdef(ra_minutes_edit.text,0)/60);
  751.             ra:=ra+strtointdef(ra_hours_edit.text,0);
  752.             dec:=strtointdef(dec_seconds_edit.text,0)/60;
  753.             dec:=(dec+strtointdef(dec_minutes_edit.text,0)/60);
  754.             dec:=dec+strtointdef(dec_degrees_edit.text,0);
  755.             send_message_check('goto(ra='+floattostr(ra)+',dec='+floattostr(dec)+')');
  756.         end;
  757. end;
  758.  
  759.     { --------------
  760.         speed controls
  761.         -------------- }
  762.  
  763. procedure tscope_control.update_speed_group(
  764.     speed_box:tpanel;
  765.     first_speed_button:tspeedbutton;
  766.     start_speed,
  767.     speed_count:integer;
  768.     event:TNotifyEvent;
  769.     can_do:boolean);
  770. var
  771.     c,i,j,k,bh,bw,bl,bt:integer;
  772.     n,l,r,t:tspeedbutton;
  773.     x,y:extended;
  774. begin
  775.     if can_do then
  776.          with speed_box do
  777.         begin
  778.             r:=first_speed_button;
  779.             n:=tspeedbutton(r.tag);
  780.             i:=speed_count;
  781.             while n<>nil do
  782.                 begin
  783.                     l:=n;
  784.                     n:=tspeedbutton(n.tag);
  785.                     dec(i);
  786.                     if i<=0 then
  787.                         begin
  788.                             if i=0 then
  789.                                 begin
  790.                                     t:=tspeedbutton(r.tag);
  791.                                     r.Tag:=longint(nil);
  792.                                     r:=t;
  793.                                 end
  794.                             else
  795.                                 r:=tspeedbutton(r.tag);
  796.                             l.free;
  797.                         end
  798.                     else
  799.                         r:=tspeedbutton(r.tag);
  800.                 end;
  801.             while i>1 do
  802.                 begin
  803.                     r.tag:=longint(tspeedbutton.create(self));
  804.                     r:=tspeedbutton(r.tag);
  805.                     r.tag:=longint(nil);
  806.                     r.Parent:=speed_box;
  807.                     dec(i);
  808.                 end;
  809.             x:=speed_count;
  810.             i:=trunc(sqrt(x));
  811.             if i>1 then
  812.                 begin
  813.                     y:=sqr(i+1);
  814.                     j:=trunc(sqrt(y));
  815.                     k:=speed_count div j;
  816.                     if (k>=i) and (speed_count mod j<>0) then
  817.                         begin
  818.                             k:=-1;
  819.                             inc(i);
  820.                         end;
  821.                 end
  822.             else
  823.                 k:=0;
  824.             if height>=width then
  825.                 begin
  826.                     if i<=1 then
  827.                         begin
  828.                             if speed_count>1 then
  829.                                 bh:=height div speed_count
  830.                             else
  831.                                 begin
  832.                                     bh:=height;
  833.                                     i:=1
  834.                                 end;
  835.                         end
  836.                     else if (k>=0) and ((speed_count mod i<>0) or (k>=i)) then
  837.                         bh:=height div (i+1)
  838.                     else
  839.                         bh:=height div i;
  840.                     n:=first_speed_button;
  841.                     if i>1 then
  842.                         bw:=width div i
  843.                     else
  844.                         begin
  845.                             bw:=width;
  846.                             n.Caption:=inttostr(start_speed);
  847.                         end;
  848.                 end
  849.             else
  850.                 begin
  851.                     if i<=1 then
  852.                         begin
  853.                             if speed_count>1 then
  854.                                 bw:=width div speed_count
  855.                             else
  856.                                 begin
  857.                                     bw:=width;
  858.                                     i:=1
  859.                                 end;
  860.                         end
  861.                     else if (k>=0) and ((speed_count mod i<>0) or (k>=i)) then
  862.                         bw:=width div (i+1)
  863.                     else
  864.                         bw:=width div i;
  865.                     n:=first_speed_button;
  866.                     if i>1 then
  867.                         bh:=height div i
  868.                     else
  869.                         begin
  870.                             bh:=height;
  871.                             n.Caption:=inttostr(start_speed);
  872.                         end;
  873.                 end;
  874.             bl:=0;
  875.             bt:=0;
  876.             c:=start_speed;
  877.             while n<>nil do
  878.                  with n do
  879.                 begin
  880.                     Width:=bw;
  881.                     top:=bt;
  882.                     left:=bl;
  883.                     inc(bl,bw);
  884.                     with speed_box do
  885.                          if height>=width then
  886.                         begin
  887.                             if bl+(bw div 2)>width then
  888.                                 begin
  889.                                     bl:=0;
  890.                                     inc(bt,bh);
  891.                                 end;
  892.                         end
  893.                     else if bt+(bh div 2)>Height then
  894.                         begin
  895.                             bt:=0;
  896.                             inc(bl,bw);
  897.                         end;
  898.                     Height:=bh;
  899.                     down:=false;
  900.                     groupindex:=1;
  901.                     allowallup:=false;
  902.                     caption:=inttostr(c);
  903.                     visible:=true;
  904.                     enabled:=true;
  905.                     onclick:=event;
  906.                     inc(c);
  907.                     n:=tspeedbutton(Tag);
  908.                 end;
  909.             first_speed_button.down:=true;
  910.         end;
  911. end;
  912.  
  913. function tscope_control.set_slew_speed(
  914.     speed_box:tpanel)
  915.     :integer;
  916. var
  917.     i:integer;
  918. begin
  919.     result:=1;
  920.     for I:= 0 to speed_box.ControlCount -1 do
  921.         begin
  922.             if tspeedbutton(speed_box.controls[i]).down=true then
  923.                 begin
  924.                     result:=strtointdef(tspeedbutton(speed_box.controls[i]).caption,i+1);
  925.                     exit;
  926.                 end;
  927.         end;
  928. end;
  929.  
  930.     { -------
  931.         logging
  932.         ------- }
  933.  
  934. procedure tscope_control.write_status_log(
  935.     e:string);
  936. begin
  937.     scope_network.update_status_log_check(e);
  938. end;
  939.  
  940.     { -------------
  941.         configuration
  942.         ------------- }
  943.  
  944. procedure tscope_control.load_settings;
  945. begin
  946.     ini_file:=tinifile.create(application_path+'server.ini');
  947.     with ini_file do
  948.         begin
  949.             move_method:=readinteger('control','move_method',window_method);
  950.             window_percent:=
  951.                 readfloat('control','window_percent',window_percent_default);
  952.             move_degrees:=readfloat('control','move_degrees',move_degrees_default);
  953.             move_minutes:=readfloat('control','move_minutes',move_minutes_default);
  954.             move_seconds:=readfloat('control','move_seconds',move_seconds_default);
  955.             window_track.Position:=trunc(window_percent) div window_track_step;
  956.             degrees_edit.text:=floattostr(window_percent);
  957.             update_degrees;
  958.             move_degrees_up_down.position:=trunc(move_degrees);
  959.             move_minutes_up_down.position:=trunc(move_minutes);
  960.             move_seconds_up_down.position:=trunc(move_seconds);
  961.             if move_method=window_method then
  962.                 window_move_button.down:=true
  963.             else
  964.                 degree_move_button.down:=true;
  965.             north_south_reversed:=ReadBool('control','swap_north_south',false);
  966.             east_west_reversed:=ReadBool('control','swap_east_west',false);
  967.             can_goto:=ReadBool('control','can_goto',false);
  968.             can_sync:=ReadBool('control','can_sync',false);
  969.             if north_south_reversed then
  970.                 begin
  971.                     north_label.Caption:='S';
  972.                     south_label.caption:='N';
  973.                 end
  974.             else
  975.                 begin
  976.                     north_label.Caption:='N';
  977.                     south_label.caption:='S';
  978.                 end;
  979.             if east_west_reversed then
  980.                 begin
  981.                     east_label.Caption:='W';
  982.                     west_label.caption:='E';
  983.                 end
  984.             else
  985.                 begin
  986.                     east_label.Caption:='E';
  987.                     west_label.caption:='W';
  988.                 end;
  989.             locked_check.checked:=true;
  990.             { form }
  991.             scope.get_dimensions(scope_control,@dimensions,'control',ini_file);
  992.             left:=dimensions.form_left;
  993.             top:=dimensions.form_top;
  994.             visible:=readbool('control','visible',false);
  995.         end;
  996.     ini_file.free;
  997. end;
  998.  
  999. procedure tscope_control.save_settings;
  1000. begin
  1001.     with ini_file do
  1002.         begin
  1003.             writeinteger('control','move_method',move_method);
  1004.             writefloat('control','window_percent',window_percent);
  1005.             writefloat('control','move_degrees',move_degrees);
  1006.             writefloat('control','move_minutes',move_minutes);
  1007.             writefloat('control','move_seconds',move_seconds);
  1008.             writeBool('control','swap_north_south',north_south_reversed);
  1009.             writeBool('control','swap_east_west',east_west_reversed);
  1010.             writeBool('control','can_goto',can_goto);
  1011.             writeBool('control','can_sync',can_sync);
  1012.             { form }
  1013.             scope.find_vdu(scope_control,@dimensions);
  1014.             scope.write_dimensions(@dimensions,left,top,'control',ini_file);
  1015.             writebool('control','visible',visible);
  1016.         end;
  1017. end;
  1018.  
  1019.     { --------
  1020.         utilites
  1021.         -------- }
  1022.  
  1023. procedure Tscope_control.change_window_method;
  1024. begin
  1025.     move_units_group.enabled:=false;
  1026.     move_degrees_edit.enabled:=false;
  1027.     move_minutes_edit.enabled:=false;
  1028.     move_seconds_edit.enabled:=false;
  1029.     move_degrees_up_down.Enabled:=false;
  1030.     move_minutes_up_down.Enabled:=false;
  1031.     move_seconds_up_down.Enabled:=false;
  1032.     move_degrees_label.Enabled:=false;
  1033.     move_minutes_label.Enabled:=false;
  1034.     move_seconds_label.Enabled:=false;
  1035.     window_track.Enabled:=true;
  1036.     degrees_edit.enabled:=true;
  1037.     move_window_group.enabled:=true;
  1038.     move_method:=window_method;
  1039.     window_move_button.down:=true;
  1040. end;
  1041.  
  1042. procedure Tscope_control.change_degree_method;
  1043. begin
  1044.     move_window_group.enabled:=false;
  1045.     window_track.Enabled:=false;
  1046.     degrees_edit.enabled:=false;
  1047.     move_degrees_edit.enabled:=true;
  1048.     move_minutes_edit.enabled:=true;
  1049.     move_seconds_edit.enabled:=true;
  1050.     move_degrees_up_down.Enabled:=true;
  1051.     move_minutes_up_down.Enabled:=true;
  1052.     move_seconds_up_down.Enabled:=true;
  1053.     move_degrees_label.Enabled:=true;
  1054.     move_minutes_label.Enabled:=true;
  1055.     move_seconds_label.Enabled:=true;
  1056.     move_units_group.enabled:=true;
  1057.     move_method:=degree_method;
  1058.     degree_move_button.down:=true;
  1059. end;
  1060.  
  1061. procedure Tscope_control.normalise(
  1062.             max_degrees:integer;
  1063.     var degrees,
  1064.             minutes,
  1065.             seconds:extended);
  1066. begin
  1067.     if (degrees>0) and (degrees>=max_degrees) then
  1068.         degrees:=max_degrees-1
  1069.     else if (degrees<0) and (degrees<=-max_degrees) then
  1070.         degrees:=-(max_degrees-1);
  1071.     if frac(degrees)<>0 then
  1072.         begin
  1073.             minutes:=0;
  1074.             seconds:=0;
  1075.             minutes:=frac(degrees)*minutes_in_degree;
  1076.             degrees:=trunc(degrees);
  1077.             seconds:=frac(minutes)*seconds_in_minute;
  1078.             minutes:=trunc(minutes);
  1079.         end
  1080.     else if frac(minutes)<>0 then
  1081.         begin
  1082.             seconds:=0;
  1083.             seconds:=frac(minutes)*seconds_in_minute;
  1084.             minutes:=trunc(minutes);
  1085.         end;
  1086. end;
  1087.  
  1088. procedure Tscope_control.update_degrees;
  1089. begin
  1090.     normalise(max_degrees,move_degrees,move_minutes,move_seconds);
  1091. end;
  1092.  
  1093. procedure Tscope_control.update_edit_boxes;
  1094. begin
  1095.     move_degrees:=strtofloatdef(move_degrees_edit.text,move_degrees);
  1096.     move_minutes:=strtofloatdef(move_minutes_edit.text,move_minutes);
  1097.     move_seconds:=strtofloatdef(move_seconds_edit.text,move_seconds);
  1098.     update_degrees;
  1099.     move_degrees_edit.text:=floattostr(move_degrees);
  1100.     move_minutes_edit.Text:=floattostr(move_minutes);
  1101.     move_seconds_edit.text:=floattostr(move_seconds);
  1102.     move_degrees_up_down.position:=trunc(move_degrees);
  1103.     move_minutes_up_down.position:=trunc(move_minutes);
  1104.     move_seconds_up_down.position:=trunc(move_seconds);
  1105. end;
  1106.  
  1107.     { ------
  1108.         events
  1109.         ------ }
  1110.  
  1111. procedure Tscope_control.FormShow(
  1112.     Sender:TObject);
  1113. begin
  1114.     with dimensions do
  1115.         begin
  1116.             top:=form_top;
  1117.             left:=form_left;
  1118.         end;
  1119. end;
  1120.  
  1121. procedure tscope_control.adjust;
  1122. begin
  1123.     with dimensions do
  1124.         begin
  1125.             form_top:=trunc(form_top/last_screen_height*current_height);
  1126.             form_left:=trunc(form_left/last_screen_width*current_width);
  1127.         end;
  1128.     if visible then
  1129.         show;
  1130. end;
  1131.  
  1132. procedure tscope_control.check_visible_and_show_hide(
  1133.     sender:tobject);
  1134. begin
  1135.     if visible then
  1136.         hide_form
  1137.     else
  1138.         show_form;
  1139.     scope.show_hide(sender,visible);
  1140. end;
  1141.  
  1142. procedure tscope_control.hide_form;
  1143. begin
  1144.     with dimensions do
  1145.         begin
  1146.             form_top:=top;
  1147.             form_left:=left;
  1148.         end;
  1149.     Visible:=false;
  1150. end;
  1151.  
  1152. procedure tscope_control.show_form;
  1153. begin
  1154.     Visible:=true;
  1155. end;
  1156.  
  1157. procedure Tscope_control.check_activate(
  1158.     Sender: TObject);
  1159. begin
  1160.     scope.form_activate(scope_control,@dimensions);
  1161. end;
  1162.  
  1163. procedure Tscope_control.east_labelClick(
  1164.     Sender: TObject);
  1165. begin
  1166.     if not locked_check.checked then
  1167.         begin
  1168.             east_west_reversed:=east_label.caption='E';
  1169.             if east_west_reversed then
  1170.                 begin
  1171.                     east_label.caption:='W';
  1172.                     west_label.caption:='E';
  1173.                 end
  1174.             else
  1175.                 begin
  1176.                     east_label.caption:='E';
  1177.                     west_label.caption:='W';
  1178.                 end;
  1179.         end;
  1180. end;
  1181.  
  1182. procedure Tscope_control.west_labelClick(
  1183.     Sender: TObject);
  1184. begin
  1185.     if not locked_check.checked then
  1186.         begin
  1187.             east_west_reversed:=west_label.caption='W';
  1188.             if east_west_reversed then
  1189.                 begin
  1190.                     east_label.caption:='W';
  1191.                     west_label.caption:='E';
  1192.                 end
  1193.             else
  1194.                 begin
  1195.                     east_label.caption:='E';
  1196.                     west_label.caption:='W';
  1197.                 end;
  1198.         end;
  1199. end;
  1200.  
  1201. procedure Tscope_control.north_labelClick(
  1202.     Sender: TObject);
  1203. begin
  1204.     if not locked_check.checked then
  1205.         begin
  1206.             north_south_reversed:=north_label.caption='N';
  1207.             if north_south_reversed then
  1208.                 begin
  1209.                     north_label.caption:='S';
  1210.                     south_label.caption:='N';
  1211.                 end
  1212.             else
  1213.                 begin
  1214.                     north_label.caption:='N';
  1215.                     south_label.caption:='S';
  1216.                 end;
  1217.         end;
  1218. end;
  1219.  
  1220. procedure Tscope_control.south_labelClick(
  1221.     Sender: TObject);
  1222. begin
  1223.     if not locked_check.checked then
  1224.         begin
  1225.             north_south_reversed:=south_label.caption='S';
  1226.             if north_south_reversed then
  1227.                 begin
  1228.                     north_label.caption:='S';
  1229.                     south_label.caption:='N';
  1230.                 end
  1231.             else
  1232.                 begin
  1233.                     north_label.caption:='N';
  1234.                     south_label.caption:='S';
  1235.                 end;
  1236.         end;
  1237. end;
  1238.  
  1239. procedure tscope_control.connect_to_scope_click(
  1240.     sender:tobject);
  1241. begin
  1242.     if scope_network.local_scope_control and not moving_scope then
  1243.         connect_to_scope;
  1244. end;
  1245.  
  1246. procedure Tscope_control.disconnect_from_scope_click(
  1247.     Sender:TObject);
  1248. begin
  1249.     if scope_network.local_scope_control and not moving_scope then
  1250.         disconnect_from_scope;
  1251. end;
  1252.  
  1253. procedure Tscope_control.goto_buttonClick(
  1254.     Sender: TObject);
  1255. begin
  1256.     go_to;
  1257. end;
  1258.  
  1259. procedure Tscope_control.degrees_editKeyPress(
  1260.             Sender: TObject;
  1261.     var Key: Char);
  1262. var
  1263.     t:extended;
  1264. begin
  1265.     if key=cr then
  1266.         begin
  1267.             t:=strtofloatdef(degrees_edit.text,0.5);
  1268.             if (t<=100) and (t>=0) then
  1269.                 begin
  1270.                     move_degrees:=t;
  1271.                     window_track.position:=trunc(t) div window_track_step;
  1272.                 end;
  1273.         end;
  1274. end;
  1275.  
  1276. procedure Tscope_control.window_trackChange(
  1277.     Sender: TObject);
  1278. begin
  1279.     with window_track do
  1280.         begin
  1281.             window_percent:=position*window_track_step;
  1282.             degrees_edit.text:=floattostr(window_percent);
  1283.         end;
  1284. end;
  1285.  
  1286. procedure Tscope_control.window_move_buttonClick(
  1287.     Sender: TObject);
  1288. begin
  1289.     change_window_method;
  1290. end;
  1291.  
  1292. procedure Tscope_control.degree_move_buttonClick(
  1293.     Sender: TObject);
  1294. begin
  1295.     change_degree_method;
  1296. end;
  1297.  
  1298. procedure Tscope_control.move_degrees_editKeyPress(
  1299.             Sender: TObject;
  1300.     var Key: Char);
  1301. begin
  1302.     if key=cr then
  1303.         update_edit_boxes;
  1304. end;
  1305.  
  1306. procedure Tscope_control.move_minutes_editKeyPress(
  1307.             Sender: TObject;
  1308.     var Key: Char);
  1309. begin
  1310.     if key=cr then
  1311.         update_edit_boxes;
  1312. end;
  1313.  
  1314. procedure Tscope_control.move_seconds_editKeyPress(
  1315.             Sender: TObject;
  1316.     var Key: Char);
  1317. begin
  1318.     if key=cr then
  1319.         update_edit_boxes;
  1320. end;
  1321.  
  1322. procedure Tscope_control.move_degrees_up_downChanging(
  1323.             Sender: TObject;
  1324.     var AllowChange: Boolean);
  1325. begin
  1326.     if not degrees_updating then
  1327.         begin
  1328.             degrees_updating:=true;
  1329.             update_edit_boxes;
  1330.             degrees_updating:=false;
  1331.         end;
  1332. end;
  1333.  
  1334. procedure Tscope_control.move_minutes_up_downChanging(
  1335.             Sender: TObject;
  1336.     var AllowChange: Boolean);
  1337. begin
  1338.     if not minutes_updating then
  1339.         begin
  1340.             minutes_updating:=true;
  1341.             update_edit_boxes;
  1342.             minutes_updating:=false;
  1343.         end;
  1344. end;
  1345.  
  1346. procedure Tscope_control.move_seconds_up_downChanging(
  1347.             Sender: TObject;
  1348.     var AllowChange: Boolean);
  1349. begin
  1350.     if not seconds_updating then
  1351.         begin
  1352.             seconds_updating:=true;
  1353.             update_edit_boxes;
  1354.             seconds_updating:=false;
  1355.         end;
  1356. end;
  1357.  
  1358. procedure Tscope_control.move_degrees_editEnter(
  1359.     Sender: TObject);
  1360. begin
  1361.     update_edit_boxes;
  1362. end;
  1363.  
  1364. procedure Tscope_control.update_ra_edit_boxes;
  1365. var
  1366.     ra_h,ra_m,ra_s:extended;
  1367. begin
  1368.     ra_h:=strtofloatdef(ra_hours_edit.text,0);
  1369.     ra_m:=strtofloatdef(ra_minutes_edit.text,0);
  1370.     ra_s:=strtofloatdef(ra_seconds_edit.text,0);
  1371.     normalise(max_hours,ra_h,ra_m,ra_s);
  1372.     ra_hours_edit.text:=floattostr(ra_h);
  1373.     ra_minutes_edit.Text:=floattostr(ra_m);
  1374.     ra_seconds_edit.text:=floattostr(ra_s);
  1375.     ra_hours_up_down.position:=trunc(ra_h);
  1376.     ra_minutes_up_down.position:=trunc(ra_m);
  1377.     ra_seconds_up_down.position:=trunc(ra_s);
  1378. end;
  1379.  
  1380. procedure Tscope_control.ra_hours_editKeyPress(
  1381.             Sender: TObject;
  1382.     var Key: Char);
  1383. begin
  1384.     if key=cr then
  1385.         update_ra_edit_boxes;
  1386. end;
  1387.  
  1388. procedure Tscope_control.ra_minutes_editKeyPress(
  1389.             Sender: TObject;
  1390.     var Key: Char);
  1391. begin
  1392.     if key=cr then
  1393.         update_ra_edit_boxes;
  1394. end;
  1395.  
  1396. procedure Tscope_control.ra_seconds_editKeyPress(
  1397.             Sender: TObject;
  1398.     var Key: Char);
  1399. begin
  1400.     if key=cr then
  1401.         update_ra_edit_boxes;
  1402. end;
  1403.  
  1404. procedure Tscope_control.update_dec_edit_boxes;
  1405. var
  1406.     dec_d,dec_m,dec_s:extended;
  1407. begin
  1408.     dec_d:=strtofloatdef(dec_degrees_edit.text,0);
  1409.     dec_m:=strtofloatdef(dec_minutes_edit.text,0);
  1410.     dec_s:=strtofloatdef(dec_seconds_edit.text,0);
  1411.     normalise(max_degrees_dec,dec_d,dec_m,dec_s);
  1412.     dec_degrees_edit.text:=floattostr(dec_d);
  1413.     dec_minutes_edit.Text:=floattostr(dec_m);
  1414.     dec_seconds_edit.text:=floattostr(dec_s);
  1415.     dec_degrees_up_down.position:=trunc(dec_d);
  1416.     dec_minutes_up_down.position:=trunc(dec_m);
  1417.     dec_seconds_up_down.position:=trunc(dec_s);
  1418. end;
  1419.  
  1420. procedure Tscope_control.dec_degrees_editKeyPress(
  1421.             Sender: TObject;
  1422.     var Key: Char);
  1423. begin
  1424.     if key=cr then
  1425.         update_dec_edit_boxes;
  1426. end;
  1427.  
  1428. procedure Tscope_control.dec_minutes_editKeyPress(
  1429.             Sender: TObject;
  1430.     var Key: Char);
  1431. begin
  1432.     if key=cr then
  1433.         update_dec_edit_boxes;
  1434. end;
  1435.  
  1436. procedure Tscope_control.dec_seconds_editKeyPress(
  1437.             Sender: TObject;
  1438.     var Key: Char);
  1439. begin
  1440.     if key=cr then
  1441.         update_dec_edit_boxes;
  1442. end;
  1443.  
  1444. procedure Tscope_control.ra_hours_up_downChanging(
  1445.             Sender: TObject;
  1446.     var AllowChange: Boolean);
  1447. begin
  1448.     if not ra_hours_updating then
  1449.         begin
  1450.             ra_hours_updating:=true;
  1451.             update_ra_edit_boxes;
  1452.             ra_hours_updating:=false;
  1453.         end;
  1454. end;
  1455.  
  1456. procedure Tscope_control.ra_minutes_up_downChanging(
  1457.             Sender: TObject;
  1458.     var AllowChange: Boolean);
  1459. begin
  1460.     if not ra_minutes_updating then
  1461.         begin
  1462.             ra_minutes_updating:=true;
  1463.             update_ra_edit_boxes;
  1464.             ra_minutes_updating:=false;
  1465.         end;
  1466. end;
  1467.  
  1468. procedure Tscope_control.ra_seconds_up_downChanging(
  1469.             Sender: TObject;
  1470.     var AllowChange: Boolean);
  1471. begin
  1472.     if not ra_seconds_updating then
  1473.         begin
  1474.             ra_seconds_updating:=true;
  1475.             update_ra_edit_boxes;
  1476.             ra_seconds_updating:=false;
  1477.         end;
  1478. end;
  1479.  
  1480. procedure Tscope_control.dec_degrees_up_downChanging(
  1481.             Sender: TObject;
  1482.     var AllowChange: Boolean);
  1483. begin
  1484.     if not dec_degrees_updating then
  1485.         begin
  1486.             dec_degrees_updating:=true;
  1487.             update_dec_edit_boxes;
  1488.             dec_degrees_updating:=false;
  1489.         end;
  1490. end;
  1491.  
  1492. procedure Tscope_control.dec_minutes_up_downChanging(
  1493.             Sender: TObject;
  1494.     var AllowChange: Boolean);
  1495. begin
  1496.     if not dec_minutes_updating then
  1497.         begin
  1498.             dec_minutes_updating:=true;
  1499.             update_dec_edit_boxes;
  1500.             dec_minutes_updating:=false;
  1501.         end;
  1502. end;
  1503.  
  1504. procedure Tscope_control.dec_seconds_up_downChanging(
  1505.             Sender: TObject;
  1506.     var AllowChange: Boolean);
  1507. begin
  1508.     if not dec_seconds_updating then
  1509.         begin
  1510.             dec_seconds_updating:=true;
  1511.             update_dec_edit_boxes;
  1512.             dec_seconds_updating:=false;
  1513.         end;
  1514. end;
  1515.  
  1516. procedure Tscope_control.move_degrees_editClick(
  1517.     Sender: TObject);
  1518. begin
  1519.     update_edit_boxes;
  1520. end;
  1521.  
  1522. procedure Tscope_control.move_minutes_editClick(
  1523.     Sender: TObject);
  1524. begin
  1525.     update_edit_boxes;
  1526. end;
  1527.  
  1528. procedure Tscope_control.move_seconds_editClick(
  1529.     Sender: TObject);
  1530. begin
  1531.     update_edit_boxes;
  1532. end;
  1533.  
  1534. end.
  1535.  
  1536.